package com.sunrate.investingquote.service.router.comparator.test.compare.v1;

import com.sunrate.investingquote.bean.router.ChannelPriorityConfig;
import com.sunrate.investingquote.bean.router.ChannelRouter;
import com.sunrate.investingquote.dto.router.comparator.RouterSortContext;
import com.sunrate.investingquote.enums.RouterPriorityEnum;

import java.math.BigDecimal;
import java.util.Comparator;

/**
 * @author yyh
 * @description:
 * @date 2023/07/04/ 15:12
 */
public class FeeRateComparator extends ComparatorCreator {

    private static final String CODE= RouterPriorityEnum.FEE_RATE.getCode();

    @Override
    protected Comparator<RouterSortContext<ChannelRouter>> create(ChainParam chainParam) {
        return Comparator.comparing(RouterSortContext::getFeeRate,Comparator.nullsLast(BigDecimal::compareTo));
    }

    @Override
    protected String getCode() {
        return CODE;
    }

}
